﻿// //  ********************************************************************************
// //  Copyright (C) 2016 Sebastian Kenter. All rights reserved.
// // 
// //  Name    : PhotonServerProject | PhotonServerFramework | IServerHandlerRegistry.cs
// //  Created : 2016 - 03 - 21 10:03
// //  Modified: 2016 - 04 - 18 09:38
// //  ********************************************************************************

using System;
using ExitGames.Logging;
using PhotonServerFramework.Interfaces.Application;
using PhotonServerFramework.Interfaces.Server;

namespace PhotonServerFramework.Interfaces.Handler
{
    /// <summary>
    ///     Interface for the server handler registry
    /// </summary>
    public interface IServerHandlerRegistry
    {
        /// <summary>
        ///     Logger instance
        /// </summary>
        ILogger Logger { get; }

        /// <summary>
        ///     Register a server handler to the internal registry and the database
        /// </summary>
        /// <param name="serverHandler">The server handler to register</param>
        /// <param name="server">The server that registers the server handler</param>
        /// <returns>true if registered, otherwise false</returns>
        bool RegisterServerHandler(IServerTelegramHandler<IServerPeer> serverHandler, IServerApplication server);

        /// <summary>
        ///     Unregister a server handler internally and from the database
        /// </summary>
        /// <param name="handlerId">Unique ID of the server handler to unregister</param>
        /// <returns>true if unregistered, otherwise false</returns>
        bool UnregisterServerHandler(Guid handlerId);

        /// <summary>
        ///     Gets a server handler from the internal registry identified by it's unique handler id
        /// </summary>
        /// <param name="handlerId">The id of the server handler to look up in the internal registry</param>
        /// <returns>IServerTelegramHandler if found, otherwise null</returns>
        IServerTelegramHandler<IServerPeer> GetServerHandlerById(Guid handlerId);
    }
}
